<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
      function start(){
         var num = parseInt(prompt('欢迎使用简易计算器：\n 1.加法运算：\n 2.减法运算：\n 3.乘法运算：\n 4.除法运算：\n 5.退出：\n 请输入您的选项：'));  
         return num;
        }
      
      function cal(num,num1,num2){
          if(num == 1){
             return num1 + num2;
          }
          else if(num == 2){
             return num1 - num2;
          }
          else if(num == 3){
             return num1 * num2;
          }
          else if(num == 4){
            if(num2 == 0){
                return undefined;
            }
            else{
             return num1 / num2;
            }
          }
        }
        
        while(true){
             
            var option = start();
            if(option!=5){
                var num1 = parseFloat(prompt('请输入第一个数字：'));
                var num2 = parseFloat(prompt('请输入第二个数字：'));
                var result = cal(option,num1,num2);
                alert(result);
            }
            else{
                break;
            }
             
        }
       
      
       
    </script>
</head>
<body>
    
</body>
</html>